package cn.akwangl.concurrency.web.model.items.service.impl;

import cn.akwangl.concurrency.web.model.items.mapper.ItemsMapper;
import cn.akwangl.concurrency.web.model.items.pojo.ItemsEntity;
import cn.akwangl.concurrency.web.model.items.service.ItemsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 商品表 商品信息相关表：分类表，商品图片表，商品规格表，商品参数表 服务实现类
 * </p>
 *
 * @author 阿坤同学
 * @since 2022-11-22 14:30:33
 */
@Service
public class ItemsServiceImpl extends ServiceImpl<ItemsMapper, ItemsEntity> implements ItemsService {

    @Override
    public Map<String, ItemsEntity> getItemsEntityMap(List<String> itemIds) {
        Map<String, ItemsEntity> resultMap = new HashMap(itemIds.size());
        List<ItemsEntity> itemsEntities = listByIds(itemIds);
        if (itemsEntities != null && !itemsEntities.isEmpty()) {
            for (ItemsEntity itemsEntity : itemsEntities) {
                String mapKey = itemsEntity.getId();
                ItemsEntity mapValue = itemsEntity;
                resultMap.put(mapKey, mapValue);
            }
        }
        return resultMap;
    }
}
